﻿/**********************************************************************
 * @file   OperatorsRemshFESubsystem.h
 * @brief  FE子系统重新划分操作器
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date   2025-01-15
 *********************************************************************/
#ifndef _OperatorsRemshFESubsystem_H
#define _OperatorsRemshFESubsystem_H

#include "FITK_Kernel/FITKCore/FITKActionOperator.h"
#include "FITK_Kernel/FITKCore/FITKOperatorRepo.h"
#include "FITK_Kernel/FITKCore/FITKThreadTask.h"

namespace Acoustics
{
    class FITKAbstractFESubSys;
}

namespace ModelOper
{
    /**
     * @brief  FE子系统重新划分操作器
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2024-10-23
     */
    class OperatorsRemshFESubsystem :public Core::FITKActionOperator
    {
        Q_OBJECT;
    public:
        /**
         * @brief Construct a new Operators RemshFESubsystem object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        explicit OperatorsRemshFESubsystem() = default;
        /**
         * @brief Destroy the Operators RemshFESubsystem object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        virtual ~OperatorsRemshFESubsystem() = default;
        /**
         * @brief 执行
         * @return true 成功
         * @return false 失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        virtual bool execGUI() override;
        /**
         * @brief 执行结果处理
         * @return true 成功
         * @return false 失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        virtual bool execProfession() override;

    protected slots:
        /**
         * @brief  拾取完成，进行网格生成
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-27
         */
        void pickDataFinish();
    };

    /**
     * @brief  gmsh脚本生成线程-用于划分板
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2024-11-18
     */
    class GmshGeoScriptGenThread :public Core::FITKThreadTask
    {
        Q_OBJECT;
    public:
        /**
         * @brief Construct a new GmshGeoScriptGenThread object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        explicit GmshGeoScriptGenThread(Core::FITKActionOperator* oper);
        /**
         * @brief Destroy the GmshGeoScriptGenThread object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        virtual ~GmshGeoScriptGenThread() = default;
        /**
         * @brief 执行函数
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-10-23
         */
        void run();

    protected:
        /**
         * @brief    写出板geo脚本
         * @param[i] geoScriptFile
         * @return   bool
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-27
         */
        bool writeShellGeoScript(QString geoScriptFile, Acoustics::FITKAbstractFESubSys* dataFEData);
        /**
         * @brief    写出梁geo脚本
         * @param[i] geoScriptFile
         * @return   bool
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-01-15
         */
        bool writeCavityGeoScript(QString geoScriptFile, Acoustics::FITKAbstractFESubSys* dataFEData);

    private:
        /**
         * @brief  操作器
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-11-22
         */
        Core::FITKActionOperator* _oper{};
    };

    // 按钮注册相关操作
    Register2FITKOperatorRepo(actionRemshFESubsystems, OperatorsRemshFESubsystem);
}

#endif